package com.forte.productservice;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.forte.productdao.Product;
import com.forte.productdao.ProductDAO;

@Transactional
public class ProductServiceImpl implements  ProductService{
	
	@Autowired
	ProductDAO productDao;
	
	public void setProductDAO(ProductDAO productDao){
		this.productDao = productDao;
	}

	public void saveOrUpdate(Product product) {
		productDao.saveOrUpdate(product);		
	}

	public List<Product> findAllProduct() {
		return productDao.findAllProduct();		
	}

	public void delete(Product product) {
		productDao.delete(product);
	}

	public Product findProductByProductId(int productId) {
		return productDao.findProductByProductId(productId);
	}

	public Product findProductByProductName(String productName) {
		return productDao.findProductByProductName(productName);
	}

	public List<Product> findProductByCategoryId(int categoryId) {
		return productDao.findProductByCategoryId(categoryId);
	}

}
